package utils
{
	import flash.display.Bitmap;
	import flash.text.AntiAliasType;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	import flash.text.TextFormat;

	public class Label extends Component
	{
		[Embed(source="assets/DroidSans.ttf", fontName="DroidSans", embedAsCFF="false")]
		private const droidSans:Class;
		protected var _textField:TextField;
		protected var _textFormat:TextFormat;
		
		public function Label(text:String)
		{
			_textFormat = new TextFormat();
			_textFormat.font = "DroidSans";
			_textFormat.color = 0;
			_textFormat.size = 11;
			
			_textField = new TextField();
			addChild(textField);
			_textField.embedFonts = true;
			_textField.setTextFormat(_textFormat);
			_textField.autoSize = TextFieldAutoSize.LEFT;
			_textField.defaultTextFormat = _textFormat;
			_textField.antiAliasType = AntiAliasType.ADVANCED;
			_textField.selectable = false;
			_textField.text = text;
		}
		
		
		public function get textField():TextField
		{
			return _textField;
		}
		
		public function set text(text:String):void
		{
			_textField.text = text;
		}
		
		public function get text():String
		{
			return _textField.text;
		}
		
		public function set size(size:int):void
		{
			_textFormat.size = size;
			_textField.setTextFormat(_textFormat);
		}
	}
}